#ifndef PLANARREFLECTOR_H
#define PLANARREFLECTOR_H


#include "Reflector.h"

#include <vector>
using std::vector;


class PlanarReflector : public Reflector
{

	public:
		PlanarReflector();
		virtual ~PlanarReflector();

		void startReflectionDraw(const Camera& camera, vector<Light*>& lights);
		void endReflectionDraw(vector<Light*>& lights);
		void init(const char* filename, ID3D11Device* g_device, ID3D11DeviceContext* g_context);
		virtual void drawReflection(const Mesh* mesh);
		
		void setWidth(int w) { width = w; }
		void setHeight(int h) { height = h; }

		int getWidth() const { return width; }
		int getHeight() const { return height; }

		void setCullBack(bool v) { mbCullBack = v; }

	private:
		
		bool mbCullBack;
		
		ID3D11RenderTargetView* rtv;
		ID3D11DepthStencilView* dsv;

		int width;
		int height;
		
		XMFLOAT4X4 m_ViewProj;

		XMFLOAT4X4 m_reflect;
		ID3DX11EffectMatrixVariable*	fx_m_WorldReflectViewProj;
		ID3DX11EffectMatrixVariable*	fx_m_WorldReflect;
		ID3DX11EffectScalarVariable*	fx_reflector_height;


		ID3DX11EffectShaderResourceVariable*	fx_tex_shadow_map;
		ID3DX11EffectVariable*					fx_lights;
		ID3DX11EffectScalarVariable*			fx_num_lights;
		ID3DX11EffectVectorVariable*			fx_pEye;
		ID3DX11EffectScalarVariable*			fx_bShadowed;
		ID3DX11EffectScalarVariable*			fx_bUsePCSS;

		std::vector<XMFLOAT4> l_pos;
		std::vector<XMFLOAT4> l_dir;
};




#endif